home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / Linien4.cpp < prev    next >
C/C++ Source or Header  |  1998-12-23  |  1KB  |  35 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Linien4.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8.  
  9. const int FMax = 16;
  10. TColor Farbe[FMax] =
  11.   {clBlack, clMaroon, clGreen, clNavy, clTeal, clPurple,
  12.    clOlive, clGray, clSilver, clRed, clLime, clBlue,
  13.    clAqua, clFuchsia, clYellow, clWhite};
  14.  
  15. TForm1 *Form1;
  16. //---------------------------------------------------------------------------
  17. __fastcall TForm1::TForm1(TComponent* Owner)
  18.     : TForm(Owner)
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22. void __fastcall TForm1::Button1Click(TObject *Sender)
  23. {
  24.   for (int i=0; i<55; i++)
  25.   {
  26.     Canvas->Pen->Color = Farbe[random(FMax)];
  27.     Canvas->Ellipse (i*3, i*2, ClientWidth-i*3, ClientHeight-i*2);
  28.   }
  29. }
  30. //---------------------------------------------------------------------------
  31. void __fastcall TForm1::FormCreate(TObject *Sender)
  32. {
  33.   randomize ();
  34. }
  35. //---------------------------------------------------------------------------